<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of getcrnrpts</title>
  <meta name="keywords" content="getcrnrpts">
  <meta name="description" content="GETCRNRPTS is a function that uses the mean and standard deviation images to adaptively obtain local maxima in an image.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
  <script type="text/javascript">
    if (top.frames.length == 0) { top.location = "../../index.html"; };
  </script>
</head>
<body>
<a name="_top"></a>
<!-- # RADOCCToolbox --><!-- menu.html CornerFinder -->
<h1>getcrnrpts
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>GETCRNRPTS is a function that uses the mean and standard deviation images to adaptively obtain local maxima in an image.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function crnrpts=getcrnrpts(imgh,mimg,stdv,th,debug) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment"> GETCRNRPTS is a function that uses the mean and standard deviation images to adaptively obtain local maxima in an image.
 
 GETCRNRPTS can be applied on the Harris transform to obtain the Harris
 corner points.
 
 USAGE:
     crnrpts=getcrnrpts(imgh,mimg,stdv,th);
 
 INPUTS:
     imgh: Harris transform of image
 
     mimg,stdv: output from ADAPTSTATS
 
     th: parameter to adjust thresholding
 
 OUTPUTS:
     crnrpts: 2xN array with coordinates of corner points</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="findcorners.html" class="code" title="function imgcout=findcorners(img,debug)">findcorners</a>	FINDCORNERS is the main function called by the calibration GUI.</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function crnrpts=getcrnrpts(imgh,mimg,stdv,th,debug)</a>
0002 <span class="comment">% GETCRNRPTS is a function that uses the mean and standard deviation images to adaptively obtain local maxima in an image.</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% GETCRNRPTS can be applied on the Harris transform to obtain the Harris</span>
0005 <span class="comment">% corner points.</span>
0006 <span class="comment">%</span>
0007 <span class="comment">% USAGE:</span>
0008 <span class="comment">%     crnrpts=getcrnrpts(imgh,mimg,stdv,th);</span>
0009 <span class="comment">%</span>
0010 <span class="comment">% INPUTS:</span>
0011 <span class="comment">%     imgh: Harris transform of image</span>
0012 <span class="comment">%</span>
0013 <span class="comment">%     mimg,stdv: output from ADAPTSTATS</span>
0014 <span class="comment">%</span>
0015 <span class="comment">%     th: parameter to adjust thresholding</span>
0016 <span class="comment">%</span>
0017 <span class="comment">% OUTPUTS:</span>
0018 <span class="comment">%     crnrpts: 2xN array with coordinates of corner points</span>
0019 
0020 <span class="comment">% Check input</span>
0021 <span class="keyword">if</span> ~exist(<span class="string">'debug'</span>,<span class="string">'var'</span>) || isempty(debug)
0022     debug=0;
0023 <span class="keyword">end</span>
0024 
0025 <span class="comment">% adaptive thresholding</span>
0026 imax=mimg+th*stdv;
0027 imax(imax&gt;1)=1;
0028 imax(imax&lt;0)=0;
0029 imghl=0*imgh;
0030 imghl(imgh&gt;imax)=1;
0031 imghl=logical(imghl);
0032 imghlf=medfilt2(imghl);
0033 imghlf=medfilt2(imghlf);
0034 
0035 <span class="comment">% get centroids of blobs as Harris corner points</span>
0036 [imglfl,n]=bwlabel(imghlf);
0037 meanx=zeros(1,n);
0038 meany=zeros(1,n);
0039 cnt=zeros(1,n);
0040 
0041 
0042 [x,y,v]=find(imglfl);
0043 
0044 <span class="keyword">for</span> cntr=1:size(x)
0045     meanx(v(cntr))=meanx(v(cntr))+x(cntr);
0046     meany(v(cntr))=meany(v(cntr))+y(cntr);
0047     cnt(v(cntr))=cnt(v(cntr))+1;
0048 <span class="keyword">end</span>
0049 
0050 meanx=round(meanx./cnt);
0051 meany=round(meany./cnt);
0052 crnrpts=[meanx;meany];
0053 
0054 <span class="comment">% debugging</span>
0055 <span class="keyword">if</span> debug
0056     close all;
0057     figure;imshow(imghl);
0058     figure;imshow(imghlf);
0059     pause;
0060 <span class="keyword">end</span></pre></div>
<hr><address>Generated on Sun 04-Apr-2010 17:13:59 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
</body>
</html>